import axios from "@/server/axios";
import type { QueryUserVO, UserVO, UserLoginVO, UserLoginResultVO } from "./types";
import api from "./api-list";

class UserController {
    login(data: UserLoginVO) {
        return axios.get<UserLoginResultVO>(api.login, data);
    }
    create(data: UserVO) {
        return axios.post(api.create, data);
    }
    update(data: UserVO) {
        return axios.post(api.update, data);
    }
    updatePwd(data: { guid: string, password: string }) {
        return axios.post(api.updatePwd, data);
    }
    delete(userId: string) {
        return axios.get(api.delete, { userId });
    }
    page(data: QueryUserVO) {
        return axios.post<UserVO[]>(api.page, data);
    }
    detail(userId: string) {
        return axios.get<UserVO>(api.detail, { userId });
    }
}

export default UserController;